package com.epfresh.bean;

import java.util.Map;

/**
 * Created by wzh on 17-1-17.
 */

public class DcCnt {

    /*{
  "productCnt": {
    "1016": 131.0,
    "1070": 60750.0,
    "1068": 3.0,
    "1069": 8.0,
    "1058": 8.0,
    "1089": 10.0,
    "1090": 5.0,
    "1051": 20.0,
    "1050": 30.0,
    "628": 207.0,
    "843": 10.0,
    "1104": 10.0,
    "1076": 857291.0
  },
  "topCategoryCnt": {
    "60|1": 13.0
  },
  "categoryCnt": {
    "11": 13.0
  },
  "shoppingCarCnt": 13
}*/
    Map<String, Double> productCnt;
    Map<String, Double> topCategoryCnt;
    //"60|1": 13.0，二级分类，id|type
    Map<String, Double> categoryCnt;

    public DcCnt() {

    }

    public Map<String, Double> getCategoryCnt() {
        return categoryCnt;
    }

    public void setCategoryCnt(Map<String, Double> categoryCnt) {
        this.categoryCnt = categoryCnt;
    }

    public Map<String, Double> getProductCnt() {
        return productCnt;
    }

    public void setProductCnt(Map<String, Double> productCnt) {
        this.productCnt = productCnt;
    }

    public Map<String, Double> getTopCategoryCnt() {
        return topCategoryCnt;
    }

    public void setTopCategoryCnt(Map<String, Double> topCategoryCnt) {
        this.topCategoryCnt = topCategoryCnt;
    }

    public double getProductItemCnt(String key) {
        if (productCnt != null) {
            Double integer = productCnt.get(key);
            if (integer != null) {
                return integer+0;
            }
        }
        return 0;
    }

    public Double getTopCategoryItemCnt(String key) {

        if (topCategoryCnt != null) {
            Double integer = topCategoryCnt.get(key);
            if (integer != null) {
                return integer;
            }
        }
        return 0d;
    }
    public void putTopProductItemCnt(String key,Double value) {
        if (topCategoryCnt != null) {
            topCategoryCnt.put(key,value);
        }


    }
    public Double getCategoryItemCnt(String key) {
        if (categoryCnt != null) {
            Double integer = categoryCnt.get(key);
            if (integer != null) {
                return integer;
            }
        }
        return 0d;
    }
    public void putProductItemCnt(String key,Double value) {
        if (productCnt != null) {
            productCnt.put(key,value);
        }

    }
    public void putCategoryItemCnt(String key,Double value) {
        if (categoryCnt != null) {
            categoryCnt.put(key,value);
        }

    }

    @Override
    public String toString() {
        return "DcCnt{" +
                "productCnt=" + productCnt +
                ", topCategoryCnt=" + topCategoryCnt +
                ", categoryCnt=" + categoryCnt +
                '}';
    }
}
